﻿using System.Linq.Expressions;

namespace GoodAdmin.System;

/// <summary>
/// 用户服务
/// </summary>
public interface ISysUserService
{   
    /// <summary>
    /// 根据ID获取用户信息
    /// </summary>
    /// <param name="userId">用户id</param>
    /// <returns></returns>
    Task<SysUser> GetUserById(long userId);

    /// <summary>
    /// 登陆时根据用户名获取用户基本信息
    /// </summary>
    /// <param name="Account"></param>
    /// <returns></returns>
    Task<SysUser> GetUserByAccount(string Account);

    /// <summary>
    /// 分页获取用户基本信息
    /// </summary>
    /// <param name="input">分页查询条件</param>
    /// <returns></returns>
    Task<SqlSugarPagedList<SysUser>> GetUserPage(UserPageInput input);
    /// <summary>
    /// 人员选择器
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<SqlSugarPagedList<UserSimpleInfo>> UserSelector(UserSelectorInput input);
    /// <summary>
    /// 人员选择器
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<List<UserSelectorOutput>> GetUserSelector(UserSelectorInput input,List<long> dataScope,bool isCheckDataScope);
    /// <summary>
    /// 添加用户
    /// </summary>
    /// <param name="userInput"></param>
    /// <returns></returns>
    Task AddUser(UserAddInput userInput);

    /// <summary>
    /// 更新用户信息
    /// </summary>
    /// <param name="userInput"></param>
    /// <returns></returns>
    Task UpdateUser(UserUpdateInput userInput);

    /// <summary>
    /// 删除用户
    /// </summary>
    /// <param name="input">用户Id列表</param>
    /// <returns></returns>
    Task DeleteUser(List<BaseIdInput> input);

    /// <summary>
    /// 根据Id禁用用户
    /// </summary>
    /// <param name="input">用户id</param>
    /// <returns></returns>
    Task<bool> DisableUser(BaseIdInput input);

    /// <summary>
    /// 根据Id启用用户
    /// </summary>
    /// <param name="input">用户id</param>
    /// <returns></returns>
    Task<bool> EnableUser(BaseIdInput input);

    /// <summary>
    /// 根据Id重置用户密码
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task ResetPassword(BaseIdInput input);

    /// <summary>
    /// 修改密码
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task ChangePassword(ChangePwdInput input);

    /// <summary>
    /// 根据用户ID解除锁定状态
    /// </summary>
    /// <param name="input"></param>
    string UnLockUser(BaseIdInput input);

    /// <summary>
    /// 用户授权角色
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task GrantUserRole(UserRoleInput input);

    /// <summary>
    /// 获取登录用户菜单及按钮列表
    /// </summary>
    /// <returns></returns>
    Task<dynamic> GetLoginUserMenuAndButton();

    /// <summary>
    /// 获取登录用户信息
    /// </summary>
    /// <returns></returns>
    Task<UserOutput> GetLoginUserDetail();

    /// <summary>
    /// 批量添加用户
    /// </summary>
    /// <param name="importData"></param>
    /// <returns></returns>
    Task<List<UserBatchAddOutput>> BatchAddUser(List<UserBatchAdd> importData);

    /// <summary>
    /// 根据指定字段及数据查询用户简易信息
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="values"></param>
    /// <param name="fieldSelector"></param>
    /// <returns></returns>
    Task<List<UserSimpleInfo>> GetUsersByField<T>(List<T> values, Expression<Func<SysUser, T>> fieldSelector);
}
